package reflect;

import java.lang.reflect.Method;

public class ReflectDemo7 {
    public static void main(String[] args)throws  Exception {
//        Person p=new Person();
//        p.hehe();
        Class cls=Class.forName("reflect.Person");
        Object obj=cls.newInstance();
//        Method method=cls.getMethod("hehe");
        Method method=cls.getDeclaredMethod("hehe");
        method.setAccessible(true);
        method.invoke(obj);
        method.setAccessible( false);
    }
}
